﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Hyt.Core.Data
{
    public class PagedQueryable<T> : IPagedQueryable<T>
    {
        public int Total { get; set; }

        public int PageSize { get; set; }

        public int PageIndex { get; set; }

        public IQueryable<T> Data { get; set; }


        public PagedList<T> ToList()
        {
            PagedList<T> list = new PagedList<T>();
            list.PageIndex = PageIndex;
            list.PageSize = PageSize;
            list.Total = Total;
            if(Data!=null)
                list.AddRange(Data.ToList());
            return list;
        }
    }
}
